package com.atguigu.gmall.product.config;

import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MybatisPlusConfiguration {
    @Bean
    MybatisPlusInterceptor mybatisPlusInterceptor(){
        MybatisPlusInterceptor interceptor =new MybatisPlusInterceptor();//总拦截器
         //分页的拦截器
        PaginationInnerInterceptor  paginationInnerInterceptor =new PaginationInnerInterceptor();
        //为了防止溢出  设置一个参数
        paginationInnerInterceptor.setOverflow(true);// 允许溢出
        interceptor.addInnerInterceptor(paginationInnerInterceptor);
        return  interceptor;
    }
}
